home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / Select_font / Select.font.rexx < prev   
OS/2 REXX Batch file  |  1996-06-22  |  2KB  |  90 lines

  1. /*
  2. ** SelectFont.rexx
  3. **
  4. ** written by Marcin Orlowski <carlos@dedal.man.szczecin.pl>
  5. **                            <http://dedal.man.szczecin.pl/~carlos>
  6. **
  7. ** $VER 1.00
  8. **
  9. ** This script is designed to help user copy system fonts, which contains
  10. ** (on disk) of drawer with main fonts, and file with postfix .font.
  11. ** using DirectoryOpus. Because DOpus doesn't select .font files automatically
  12. ** (like .icon files) we have to do it ourself: by hand or... using this script.
  13. ** If you want to use this script to select something with other postfix
  14. ** (e.g .PFB, .AFM) just use your postfix as script argument:
  15. **
  16. **     ARexx    REXX:DOpus/Select.font.rexx my_postfix
  17. **
  18. ** Default postfix is ".font".
  19. **
  20. ** Usage: Just select drawer you want and call this script. All existing and
  21. ** connected .font files will be selected. Selected drawers which doesn't
  22. ** have its pair (.font) will be deselected (or not: depends on DESELECTWRONG
  23. ** flag -> if TRUE deselection is performed.
  24. **
  25. ** © 1994 - W.F.M.H.
  26. */
  27.  
  28. OPTIONS RESULTS
  29.  
  30. TRUE        = 1
  31. FALSE        = 0
  32.  
  33. NL            = '0A'X
  34. DefPostFix    = '.font'     /* default postfix */
  35. DeselectWrong = FALSE       /* change to TRUE if you want unpair drawers
  36.                                to be deselected */
  37. DOPUSToFront
  38.  
  39. PARSE ARG PostFix           /* check for custom postfix */
  40. IF PostFix = "" THEN PostFix = DefPostFix    /* not present use default */
  41.  
  42. Status 3                    /* get number of the active window */
  43. ActiveWindow = RESULT
  44.  
  45. GetSelectedDirs '"/"' ActiveWindow
  46. SelectedDrawers = RESULT || "/"
  47.  
  48. WordStart = 1
  49. WordEnd = 2
  50.  
  51. Status 8 ActiveWindow       /* how many selected drawers in the active window */
  52. Licznik = RESULT
  53.  
  54. IF Licznik > 0 THEN
  55.  DO  
  56.   Total = Licznik
  57.   Found = 0
  58.   Wrong = 0
  59.  
  60.   DO Licznik
  61.     WordEnd=POS('/', SelectedDrawers, WordEnd);
  62.     FontName=SUBSTR(SelectedDrawers, WordStart, WordEnd-WordStart)
  63.     SelectFile FontName || PostFix 1
  64.     if (RESULT >= 0) THEN
  65.         Found = Found + 1
  66.     ELSE
  67.         DO
  68.         IF DeselectWrong THEN
  69.             SelectFile FontName 0
  70.         Wrong = Wrong + 1
  71.         END
  72.  
  73.     WordEnd=WordEnd+1
  74.     WordStart=WordEnd
  75.   END
  76.  
  77.   EndText = "Found " || Found || " *" || PostFix || " files."
  78.  
  79.   IF ((DeselectWrong) & (Wrong>0)) THEN
  80.     EndText = EndText || " Deselected " || Wrong || " dirs."
  81.  
  82.   TopText EndText
  83.   DisplayDir ActiveWindow
  84.  
  85.  END
  86.  
  87. ELSE
  88.  
  89.  TopText "Select any drawer first!"
  90.